﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace VConfigs
{
    /// <summary>
    /// 配置层基类
    /// </summary>
    public abstract class ConfigBase
    {
        /// <summary>
        /// 得到指定节点的值
        /// </summary>
        /// <param name="value">从服务文件中找到指定节点对应的值</param>
        /// <returns></returns>
        protected static string GetAppSetting(string value)
        {
            return GetAppSetting(value, string.Empty);
        }
        /// <summary>
        /// 得到指定节点的值
        /// </summary>
        /// <param name="value">从服务文件中找到指定节点对应的值</param>
        /// <param name="defaultValue">如果没有结果，则返回默认值</param>
        /// <returns></returns>
        protected static string GetAppSetting(string value, string defaultValue)
        {
            return ConfigurationManager.AppSettings[value] == null ? defaultValue : ConfigurationManager.AppSettings[value].ToString();
        }
    }
}
